﻿using System;
using System.Collections.Generic;

namespace Paypayes.Aelda.Core
{
    public abstract class SimulationObject
    {
        /// <summary>
        /// unique Id of the simulation object.
        /// </summary>
        public virtual UInt64 Id { get; private set; }
        
        /// <summary>
        /// List of subscribers of events coming from this simulation object.
        /// </summary>
        public event EventHandler<EventArgs> Subscribers;

        public Dictionary<UInt64, SimulationObject> Contents;

        public Dictionary<UInt64, SimulationObject> Links;

        public UInt64 OwnerId;

        public Dictionary<String, Object> Properties;

        /// <summary>
        /// Default constructor of the simulation object
        /// </summary>
        public SimulationObject(UInt64 id)
        {
            Id = id;
            Contents = new Dictionary<ulong, SimulationObject>();
            Links = new Dictionary<ulong, SimulationObject>();
            Properties = new Dictionary<String, Object>();
        }

        public abstract void ReceiveEvent(EventArgs e);

        public virtual Boolean Store() { return true;  }//throw new NotImplementedException(); }

        public virtual Boolean Restore() { throw new NotImplementedException(); }
    }
}
